package tx.bj12320.model;

import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import tx.bj12320.model.*;
import tx.bj12320.dao.*;
import tx.bj12320.service.*;
import tx.bj12320.vo.query.*;


@Entity
@Table(name = "BJ12320_DOC_INFO")
public class DocInfo extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;

	//alias
	public static final String TABLE_ALIAS = "公文";
	public static final String ALIAS_DOC_INFO_ID = "公文ID";
	public static final String ALIAS_DOC_INFO_TYPE = "公文类型";
	public static final String ALIAS_TITLE = "标题";
	public static final String ALIAS_DOC_NUM = "文号";
	public static final String ALIAS_DOC_SORT = "文种";
	public static final String ALIAS_BW_DATE = "报文时间";
	public static final String ALIAS_ZW_UNIT = "制文单位";
	public static final String ALIAS_NG_PERSON = "拟稿人";
	public static final String ALIAS_ZS_UNIT = "主送机关";
	public static final String ALIAS_INFO_GKSX = "信息公开属性";
	public static final String ALIAS_BYGKYY = "不予公开原因";
	public static final String ALIAS_BMQX = "保密期限";
	public static final String ALIAS_DMYJ = "定密依据";
	public static final String ALIAS_MJ = "密级";
	public static final String ALIAS_KEYWORD = "主题词";
	public static final String ALIAS_ZBBM = "主办部门";
	public static final String ALIAS_YS = "页数";
	public static final String ALIAS_SWRQ = "收文日期";
	public static final String ALIAS_JJCD = "紧急程度";
	public static final String ALIAS_QFR = "签发人";
	public static final String ALIAS_HQ_UNIT = "会签单位";
	public static final String ALIAS_LW_UNIT = "来文机关";
	public static final String ALIAS_DOC_NAME = "公文正文名称";
	public static final String ALIAS_DOC_FILE_NAME = "公文正文文件";

	//date formats
	public static final String FORMAT_BW_DATE = DATE_FORMAT;
	public static final String FORMAT_SWRQ = DATE_FORMAT;


	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * 公文ID       db_column: DOC_INFO_ID
     */
	
	private Long docInfoId;
    /**
     * 公文类型       db_column: DOC_INFO_TYPE
     */
	@Length(max=500)
	private java.lang.String docInfoType;
    /**
     * 标题       db_column: TITLE
     */
	@Length(max=500)
	private java.lang.String title;
    /**
     * 文号       db_column: DOC_NUM
     */
	@Length(max=500)
	private java.lang.String docNum;
    /**
     * 文种       db_column: DOC_SORT
     */
	@Length(max=500)
	private java.lang.String docSort;
    /**
     * 报文时间       db_column: BW_DATE
     */
	
	private java.util.Date bwDate;
    /**
     * 制文单位       db_column: ZW_UNIT
     */
	@Length(max=500)
	private java.lang.String zwUnit;
    /**
     * 拟稿人       db_column: NG_PERSON
     */
	@Length(max=500)
	private java.lang.String ngPerson;
    /**
     * 主送机关       db_column: ZS_UNIT
     */
	@Length(max=500)
	private java.lang.String zsUnit;
    /**
     * 信息公开属性       db_column: INFO_GKSX
     */
	@Length(max=500)
	private java.lang.String infoGksx;
    /**
     * 不予公开原因       db_column: BYGKYY
     */
	@Length(max=500)
	private java.lang.String bygkyy;
    /**
     * 保密期限       db_column: BMQX
     */
	@Length(max=500)
	private java.lang.String bmqx;
    /**
     * 定密依据       db_column: DMYJ
     */
	@Length(max=500)
	private java.lang.String dmyj;
    /**
     * 密级       db_column: MJ
     */
	@Length(max=500)
	private java.lang.String mj;
    /**
     * 主题词       db_column: KEYWORD
     */
	@Length(max=500)
	private java.lang.String keyword;
    /**
     * 主办部门       db_column: ZBBM
     */
	@Length(max=500)
	private java.lang.String zbbm;
    /**
     * 页数       db_column: YS
     */
	@Length(max=500)
	private java.lang.String ys;
    /**
     * 收文日期       db_column: SWRQ
     */
	
	private java.util.Date swrq;
    /**
     * 紧急程度       db_column: JJCD
     */
	@Length(max=500)
	private java.lang.String jjcd;
    /**
     * 签发人       db_column: QFR
     */
	@Length(max=500)
	private java.lang.String qfr;
    /**
     * 会签单位       db_column: HQ_UNIT
     */
	@Length(max=500)
	private java.lang.String hqUnit;
    /**
     * 来文机关       db_column: LW_UNIT
     */
	@Length(max=500)
	private java.lang.String lwUnit;
    /**
     * 公文正文名称       db_column: DOC_NAME
     */
	@Length(max=500)
	private java.lang.String docName;
    /**
     * 公文正文文件       db_column: DOC_FILE_NAME
     */
	@Length(max=500)
	private java.lang.String docFileName;
	//columns END


	public DocInfo(){
	}

	public DocInfo(
		Long docInfoId
	){
		this.docInfoId = docInfoId;
	}



	public void setDocInfoId(Long value) {
		this.docInfoId = value;
	}

	@Id	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="BJ12320_DOC_INFO_SEQU")
    @SequenceGenerator(name="BJ12320_DOC_INFO_SEQU",allocationSize=1,initialValue=1, sequenceName="BJ12320_DOC_INFO_SEQU")
	@Column(name = "DOC_INFO_ID", unique = true, nullable = false, insertable = true, updatable = true, length = 0)
	public Long getDocInfoId() {
		return this.docInfoId;
	}

	@Column(name = "DOC_INFO_TYPE", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getDocInfoType() {
		return this.docInfoType;
	}

	public void setDocInfoType(java.lang.String value) {
		this.docInfoType = value;
	}

	@Column(name = "TITLE", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getTitle() {
		return this.title;
	}

	public void setTitle(java.lang.String value) {
		this.title = value;
	}

	@Column(name = "DOC_NUM", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getDocNum() {
		return this.docNum;
	}

	public void setDocNum(java.lang.String value) {
		this.docNum = value;
	}

	@Column(name = "DOC_SORT", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getDocSort() {
		return this.docSort;
	}

	public void setDocSort(java.lang.String value) {
		this.docSort = value;
	}

	@Transient
	public String getBwDateString() {
		return DateConvertUtils.format(getBwDate(), FORMAT_BW_DATE);
	}
	public void setBwDateString(String value) {
		setBwDate(DateConvertUtils.parse(value, FORMAT_BW_DATE,java.util.Date.class));
	}

	@Column(name = "BW_DATE", unique = false, nullable = true, insertable = true, updatable = true, length = 7)
	public java.util.Date getBwDate() {
		return this.bwDate;
	}

	public void setBwDate(java.util.Date value) {
		this.bwDate = value;
	}

	@Column(name = "ZW_UNIT", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getZwUnit() {
		return this.zwUnit;
	}

	public void setZwUnit(java.lang.String value) {
		this.zwUnit = value;
	}

	@Column(name = "NG_PERSON", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getNgPerson() {
		return this.ngPerson;
	}

	public void setNgPerson(java.lang.String value) {
		this.ngPerson = value;
	}

	@Column(name = "ZS_UNIT", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getZsUnit() {
		return this.zsUnit;
	}

	public void setZsUnit(java.lang.String value) {
		this.zsUnit = value;
	}

	@Column(name = "INFO_GKSX", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getInfoGksx() {
		return this.infoGksx;
	}

	public void setInfoGksx(java.lang.String value) {
		this.infoGksx = value;
	}

	@Column(name = "BYGKYY", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getBygkyy() {
		return this.bygkyy;
	}

	public void setBygkyy(java.lang.String value) {
		this.bygkyy = value;
	}

	@Column(name = "BMQX", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getBmqx() {
		return this.bmqx;
	}

	public void setBmqx(java.lang.String value) {
		this.bmqx = value;
	}

	@Column(name = "DMYJ", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getDmyj() {
		return this.dmyj;
	}

	public void setDmyj(java.lang.String value) {
		this.dmyj = value;
	}

	@Column(name = "MJ", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getMj() {
		return this.mj;
	}

	public void setMj(java.lang.String value) {
		this.mj = value;
	}

	@Column(name = "KEYWORD", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getKeyword() {
		return this.keyword;
	}

	public void setKeyword(java.lang.String value) {
		this.keyword = value;
	}

	@Column(name = "ZBBM", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getZbbm() {
		return this.zbbm;
	}

	public void setZbbm(java.lang.String value) {
		this.zbbm = value;
	}

	@Column(name = "YS", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getYs() {
		return this.ys;
	}

	public void setYs(java.lang.String value) {
		this.ys = value;
	}

	@Transient
	public String getSwrqString() {
		return DateConvertUtils.format(getSwrq(), FORMAT_SWRQ);
	}
	public void setSwrqString(String value) {
		setSwrq(DateConvertUtils.parse(value, FORMAT_SWRQ,java.util.Date.class));
	}

	@Column(name = "SWRQ", unique = false, nullable = true, insertable = true, updatable = true, length = 7)
	public java.util.Date getSwrq() {
		return this.swrq;
	}

	public void setSwrq(java.util.Date value) {
		this.swrq = value;
	}

	@Column(name = "JJCD", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getJjcd() {
		return this.jjcd;
	}

	public void setJjcd(java.lang.String value) {
		this.jjcd = value;
	}

	@Column(name = "QFR", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getQfr() {
		return this.qfr;
	}

	public void setQfr(java.lang.String value) {
		this.qfr = value;
	}

	@Column(name = "HQ_UNIT", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getHqUnit() {
		return this.hqUnit;
	}

	public void setHqUnit(java.lang.String value) {
		this.hqUnit = value;
	}

	@Column(name = "LW_UNIT", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getLwUnit() {
		return this.lwUnit;
	}

	public void setLwUnit(java.lang.String value) {
		this.lwUnit = value;
	}

	@Column(name = "DOC_NAME", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getDocName() {
		return this.docName;
	}

	public void setDocName(java.lang.String value) {
		this.docName = value;
	}

	@Column(name = "DOC_FILE_NAME", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getDocFileName() {
		return this.docFileName;
	}

	public void setDocFileName(java.lang.String value) {
		this.docFileName = value;
	}


	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("DocInfoId",getDocInfoId())
			.append("DocInfoType",getDocInfoType())
			.append("Title",getTitle())
			.append("DocNum",getDocNum())
			.append("DocSort",getDocSort())
			.append("BwDate",getBwDate())
			.append("ZwUnit",getZwUnit())
			.append("NgPerson",getNgPerson())
			.append("ZsUnit",getZsUnit())
			.append("InfoGksx",getInfoGksx())
			.append("Bygkyy",getBygkyy())
			.append("Bmqx",getBmqx())
			.append("Dmyj",getDmyj())
			.append("Mj",getMj())
			.append("Keyword",getKeyword())
			.append("Zbbm",getZbbm())
			.append("Ys",getYs())
			.append("Swrq",getSwrq())
			.append("Jjcd",getJjcd())
			.append("Qfr",getQfr())
			.append("HqUnit",getHqUnit())
			.append("LwUnit",getLwUnit())
			.append("DocName",getDocName())
			.append("DocFileName",getDocFileName())
			.toString();
	}

	public int hashCode() {
		return new HashCodeBuilder()
			.append(getDocInfoId())
			.toHashCode();
	}

	public boolean equals(Object obj) {
		if(obj instanceof DocInfo == false) return false;
		if(this == obj) return true;
		DocInfo other = (DocInfo)obj;
		return new EqualsBuilder()
			.append(getDocInfoId(),other.getDocInfoId())
			.isEquals();
	}
}

